<template>
	<avue-crud :option="option" :data="data" v-model="form" ref="crud" @selection-change="selectionChange" @search-change="searchChange"
	 @search-reset="searchReset" @on-load="onLoad">
		<template slot="menuLeft">
			<el-button type="primary" size="small" @click.stop="handleClose">确定</el-button>
		</template>
	</avue-crud>
</template>

<script>
	import request from '@/router/axios';

	export default {
		props: {
			orderCode: ''
		},
		data() {
			return {
				selects: [],
				form: {},
				query: {},
				option: {
					selection: true,
					searchShow: false,
					searchMenuSpan: 6,
					border: true,
					refreshBtn: false,
					addBtn: false,
					editBtn: false,
					delBtn: false,
					menu: false,
					column: [{
						label: "入库订单",
						prop: "orderCode",
						width:150
					},{
						label: "条码",
						prop: "barCode",
						width:150
					},{
						label: "数量",
						prop: "quantity",
						width:100
					},{
						label: "备注",
						prop: "remark"
					}]
				},
				data: []
			};
		},
		created() {
		},
		mounted() {},
		methods: {
			handleClose() {
				this.$emit('closeMoule', this.selects)
			},
			selectionChange(list) {
				this.selects = list;
				// this.$emit('closeMoule', list);
			},
			searchReset() {
				this.query = {};
				this.onLoad();
			},
			searchChange(params, done) {
				this.query = params;
				this.onLoad();
				done();
			},
			onLoad() {
				request({
					url: '2/api/OrderInDetail/pages',
					params: {
						key: this.query.barCode == undefined ? '' : this.query.barCode,
						type: this.orderCode == undefined ? '' : this.orderCode,
						limit: 0
					}
				}).then(res => {
					const data = res.data.data
					// data.forEach(ele => {
					// 	ele.id=''
					// });
					this.data = data
				});
			}
		}
	};
</script>

<style>
	.avue-crud__menu {
		min-height: 0px;
	}
</style>
